import { get } from 'lodash-es'

export class ReservationRefund {
  id?: string
  reservation_prepay_id?: string
  hotel_id?: string
  openid?: string
  appid?: string
  mchid?: string
  business_date?: string
  confirm_number?: string
  resv_name_id?: string
  primary_confirm_number?: string
  primary_resv_name_id?: string
  out_trade_no?: string
  wx_transaction_id?: string
  reason?: string
  reference?: string
  out_refund_no?: string
  refund_id?: string
  refund_amount?: number
  channel?: string
  user_received_account?: string
  refund_status?: string
  funds_account?: string
  success_time?: string
  post_to_pms?: boolean
  is_pms_posted?: boolean
  created_at?: string
  updated_at?: string
  version?: number;

  [key: string]: any

  constructor(data?: ReservationRefund) {
    this.init(data)
  }
}

ReservationRefund.prototype.init = function init(data?: ReservationRefund) {
  this.id = get(data, 'id')
  this.reservation_prepay_id = get(data, 'reservation_prepay_id')
  this.hotel_id = get(data, 'hotel_id')
  this.openid = get(data, 'openid')
  this.appid = get(data, 'appid')
  this.mchid = get(data, 'mchid')
  this.business_date = get(data, 'business_date')
  this.confirm_number = get(data, 'confirm_number')
  this.resv_name_id = get(data, 'resv_name_id')
  this.primary_confirm_number = get(data, 'primary_confirm_number')
  this.primary_resv_name_id = get(data, 'primary_resv_name_id')
  this.out_trade_no = get(data, 'out_trade_no')
  this.wx_transaction_id = get(data, 'wx_transaction_id')
  this.reason = get(data, 'reason')
  this.reference = get(data, 'reference')
  this.out_refund_no = get(data, 'out_refund_no')
  this.refund_id = get(data, 'refund_id')
  this.refund_amount = get(data, 'refund_amount')
  this.channel = get(data, 'channel')
  this.user_received_account = get(data, 'user_received_account')
  this.refund_status = get(data, 'refund_status')
  this.funds_account = get(data, 'funds_account')
  this.success_time = get(data, 'success_time')
  this.post_to_pms = get(data, 'post_to_pms', false)
  this.is_pms_posted = get(data, 'is_pms_posted', false)
  this.created_at = get(data, 'created_at')
  this.updated_at = get(data, 'updated_id')
  this.version = get(data, 'version')
}
